<%@ page language="java" pageEncoding="UTF-8" %>
<%@ include file="/commons/jsp/taglibs.jsp" %>
<%@taglib uri="http://www.framework.com/taglib/tree" prefix="tree" %>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
<style type="text/css">
    li {
        padding-top: 8px;
    }
</style>
<form name="addCancelDataForm" id="addCancelResonForm" method="post" action="${ctx}/business/projectmanage/saveCancel">
    <input type="hidden" name="backExecuteTime" id="backExecuteTime" value="${project.backExecuteTime}"/>
    <input type="hidden" name="budgetMenuData" id="budgetMenuData"/>
    <input type="hidden" name="companyName" id="companyName" value="${executeDeposit.pk.companyName}"/>
    <input type="hidden" name="hstSeqNum" id="hstSeqNum" value="${executeDeposit.pk.hstSeqNum}"/>
    <input type="hidden" name="bidderId" id="bidderId" value="${executeDeposit.bidderId}"/>
    <input type="hidden" name="depositstatus" id="depositstatus" value="${executeDeposit.status}"/>
    <input type="hidden" name="now" id="now" value="${now}"/>
    <table class="infoTable">
        <tbody>
        <tr>
            <th style="width: 50px;">单位名称</th>
            <td style="width: 30%;">${executeDeposit.pk.companyName}</td>
            <th style="width: 50px;">缴纳金额 </th>
             <td>${executeDeposit.tnAmount}</td>
        </tr>
        <tr>
            <th style="width: 50px;">缴纳时间</th>
            <td style="width: 30%;"><fmt:formatDate value="${executeDeposit.transTime}" pattern="yyyy年MM月dd日  HH:mm:ss" /></td>
            <th style="width:50px">交易流水号</th>
             <td style="width: 30%;">${executeDeposit.pk.hstSeqNum}</td>
        </tr>
        <tr>
            <th style="width: 50px;">是否提交退还申请 </th>
            <td style="width: 30%;" id="returnOpt"></td>
            <th style="width: 50px;">退还状态</th>
            <td style="width: 30%;" id="status"></td>
        </tr>
         <tr>
            <th style="width: 50px;">中间状态</th>
            <td>${executeDeposit.addWord}</td>
            <th style="width: 50px;">保证金退还时间</th>
            <td><fmt:formatDate value="${project.backExecuteTime}" pattern="yyyy年MM月dd日" /></td>
        </tr>

        <tr>
            <th style="width: 100px;">履约保证金退还说明资料</th>
            <td  colspan="3">
				<div id="fileQueue1" class="fileQueue" style="margin: 10px 0px 0px 10px;float: left">
					<input type="file" name="uploadify" id="otherUpload1"  class="upload"/>
					<a href="javascript:void(0);" onclick="" id="tip1" class="easyui-linkbutton" iconCls="icon-help" plain="true" title=""></a>
					<p style="color: #aaaaaa;width: auto">
						1、按住Ctrl可选择多个文件上传;<br/>
						2、可上传*.rar;*.zip;*.doc;*.docx;*.xls;*.xlsx;*.jpg;*.png;*.gif;*.bmp;*.pdf;*.dwg;*.DXF;*.DWT;*.dws类型文件<br/>
					</p>
				</div>
			</td>
        </tr>
        </tbody>
    </table>
</form>

<script type="text/javascript">
    $(function () {
		$("#otherUpload1").uploadify({
			'height'        : 27,
			'width'         : 80,
			'buttonText'    : '选择附件',
			'queueID': 'fileQueue1',//队列的ID
			'queueSizeLimit':5,// 附件附列长度
			'swf': '${ctx}/commons/js/uploadify/uploadify.swf',
			'uploader':'${ctx}/auction/business/upload;jsessionid=${pageContext.session.id}?functionFlag=50',// 上传时请求的后台处理的controller
			'cancelImg': '${ctx}/commons/js/uploadify/uploadify-cancel.png',
			'method':'post',
			'folder': '',
			'preventCaching' : true,
			'fileTypeExts' :'*.rar;*.zip;*.doc;*.docx;*.xls;*.xlsx;*.jpg;*.png;*.gif;*.bmp;*.pdf;*.dwg;*.DXF;*.DWT;*.dws',
			'auto': true,
			'multi': true,//是否可多选
			'removeCompleted' : false,
			'successTimeout' : 55555,
			'fileSizeLimit'  : 2048*50,
			'onUploadSuccess':function(file, data, response){
				$('#' + file.id).find('.data').html(' 上传完毕');
				$('#budgetMenuData').val($('#budgetMenuData').val() + "," + data);
				var cancel=$('.fileQueue .uploadify-queue-item[id="' + file.id + '"]').find(".cancel a");
				if (cancel) {
					cancel.attr("rel", data);
					cancel.click(function () {
						var cancelData = cancel.attr("rel");
						var  budgetMenuData = $('#budgetMenuData').val();
						var index = budgetMenuData.indexOf(","+cancel.attr("rel"))
						if(index != -1){
							budgetMenuData = budgetMenuData.replace(","+cancelData,"");
							$('#budgetMenuData').val(budgetMenuData);
						}
					});
				}
			},
			'onSelectError':function(file, errorCode, errorMsg){
				switch(errorCode) {
					case -110:
						//this.queueData.errorMsg="文件 ["+file.name+"] 大小超出系统限制的"+$('#file_upload').uploadify('settings','fileSizeLimit')+"大小！";
						this.queueData.errorMsg='所选文件大小超出系统限制!';
						break;
					case -120:
						//this.queueData.errorMsg="文件 ["+file.name+"] 大小异常！"
						this.queueData.errorMsg='所选文件大小异常!';
						break;
					case -130:
						//this.queueData.errorMsg="文件 ["+file.name+"] 类型不正确！"
						this.queueData.errorMsg='所选文件类型不正确!';
						break;
				}
			},
			'onCancel' : function(file){
				alert(file);
			}
		});

      formatStatus();
      formatOpt();
    });
    function deleteFile(v, resId) {
        var parent = v.parentNode;
        parent.parentNode.removeChild(parent);
        var budgetMenuData = $('#budgetMenuData').val();
        var index = budgetMenuData.indexOf("," + resId)
        if (index != -1) {
            budgetMenuData = budgetMenuData.replace("," + resId, "");
            $('#budgetMenuData').val(budgetMenuData);
        }
    }

    	function formatStatus() {
              var status="${executeDeposit.status}";
                    if (status == 0) {
                        $("#status").append('<font color="blue">未退还</font>') ;
                    } else if (status == 1) {
                         $("#status").append('<font color="green">已退还</font>') ;
                    } else if (status == 2) {
                         $("#status").append('<font color="red">扣除</font>') ;
                    }else if(status==-1){
                         $("#status").append('<font color="orange">退还失败</font>') ;
                    }
		    }

        function formatOpt() {
             var returnOpt="${executeDeposit.returnOpt}";
                    if (returnOpt == 0) {
                       $("#returnOpt").append('<font color="blue">未申请</font>');
                    } else if (returnOpt == 1) {
                         $("#returnOpt").append('<font color="green">申请成功</font>');
                    }else if (returnOpt == -1){
                         $("#returnOpt").append('<font color="orange">申请超时</font>');
                    }else if(returnOpt == 2){
                         $("#returnOpt").append('<font color="red">申请失败</font>');
                    }
                }
</script>
		